import request from '@/utils/request'
import axios from 'axios'

export default {
  // 用户密码登录
  login(ucenterMember) {
    return request({
      url: '/ucenter/login',
      method: 'post',
      data: ucenterMember
    })
  },
  // 用户验证码登录
  codeLogin(ucenterMember) {
    return request({
      url: '/ucenter/codeLogin',
      method: 'post',
      data: ucenterMember
    })
  },
  // 根据token查询用户信息
  getMemberInfo(token) {
    return request({
      url: '/ucenter/getMemberInfo',
      method: 'post',
      params: { token }
    })
  },
  // 查询手机号是否被注册
  getMobileIsExist(mobile) {
    return axios({
      url: `http://localhost:88/api/ucenter/getMobileIsExist/${mobile}`,
      method: 'get',
    })
  },
  // 发送验证码
  sendMsm(phone) {
    return request({
      url: `/msm/send/${phone}`,
      method: 'get',
    })
  },
  // 根据手机号获取验证码
  getCode(phone) {
    return request({
      url: `/msm/getCode/${phone}`,
      method: 'get',
    })
  },
  // 用户注册
  registerUser(ucenterMember) {
    return request({
      url: `/ucenter/register`,
      method: 'post',
      data: ucenterMember
    })
  },
}

